package cn.darkhorse.config;


import cn.darkhorse.core.consts.WorkflowParamConsts;
import cn.darkhorse.core.param.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @description:
 * @author: mr.wang
 * @time: 2020/6/4 0004 14:13
 */
@Configuration
public class WorkflowConfig {

	@Resource(name = "TaskGroupImpl")
	IUser taskGroupImpl;
	@Resource(name = "TaskRelativePostImpl")
	IUser taskRelativePostImpl;

	@Bean
    public WorkflowParamAnalysis injection(){
		ParamParserStrategyFactory pf = new ParamParserStrategyFactory();
	    pf.addParamParserStrategy(WorkflowParamConsts.CLASS_TASK_GROUP,new ParserStrategy4TaskGroup(taskGroupImpl));
	    pf.addParamParserStrategy(WorkflowParamConsts.CLASS_TASK_RELATIVE_POST,new ParserStrategy4TaskRelativePost(taskRelativePostImpl));
	    WorkflowParamAnalysis workflowParamAnalysis = new WorkflowParamAnalysis(pf);
	    return workflowParamAnalysis;
   }


}
